# -*- coding: utf-8 -*-
#企业证书等级维护
import json

def getCompanyCertLevelList(request):
    request.cursor_standard.execute(request.formatSql('''
        select * 
        from dict_company_apt_level 
        order by level_class,level_order  
    '''))
    rows = request.cursor_standard.fetchall()
    return json.dumps(rows, ensure_ascii=False)

def insertCompanyCertLevel(request):
    request.cursor_standard.execute(request.formatSql('''
        insert into dict_company_apt_level(level_name,level_order,level_class)
        values('${qual_level_name}','${qual_level_order}','${qual_level_class}')
    '''))
    return str(request.cursor_standard.rowcount)

def updateCompanyCertLevel(request):
    request.cursor_standard.execute(request.formatSql('''
        update dict_company_apt_level
        set
            level_name = '${level_name}',
            level_order = '${level_order}',
            level_class= '${level_class}'
        where level_id = ${level_id}
    '''))
    return str(request.cursor_standard.rowcount)